{extend name="personcentor/information"}
{block name="main"}
<div class="col-main">
    <div class="main-wrap">
        <div style="height:100px"></div>
        <div style="margin-left:8%;">

            <table class="table table-hover " >
                <caption><h3 style="margin-left:40%;">我所认证的商家</h3></caption>
                <tr>
                    <th style='text-align: center;'>商家名字</th>
                    <th style='text-align: center;'>商家电话</th>
                    <th style='text-align: center;'>身份证名/企业名</th>
                    <th style='text-align: center;'>身份证/营业执照号</th>
                    <th style='text-align: center;'>身份证照/营业执照</th>

                    <th style='text-align: center;'>审核</th>
                    <th style='text-align: center;'>操作</th>
                </tr>
                {volist name="goodresource" id="vo"}
                <input class="input" type="hidden" value="{$vo.id}"/>
                <tr align="middle">
                    <td>{$vo.link_name}</td>
                    <td>{$vo.link_phone}</td>
                    <td>{$vo.name_company}</td>
                    <td>{$vo.id_reg}</td>
                    <td><img src="/uploads/business/{:str_replace('\','/',$vo.ros_charter)}" style="width:100px;height:30px;"></td>

                    <td>{if condition="$vo.audit eq 0"}待审核
                        {elseif condition="$vo.audit eq 1" /}审核通过
                        {else}审核不通过
                        {/if}
                    </td>
                    <td>
                        <a type="button" class="btn btn-info" href="{:url('index/business/goodsinformationedit',['id'=>$vo.id])}" ><span class="glyphicon glyphicon-wrench"></span></a>
                        <div type="button" data-id="{$vo.id}" class="btn btn-danger del-btn"><span class="glyphicon glyphicon-trash"></span></div>
                    </td>
                </tr>
                {/volist}

            </table>
        </div>
    </div>
</div>
<script>
    $(function(){
        //点击删除触发事件
        $('.del-btn').click(function() {
            var ac_id = $(this).attr('data-id');
            if (confirm('你确定要 [ 删除 ] 该商户么?')) {
                var obj = $(this).parents('tr');

                delAjax(ac_id, obj);   //调用执行ajax删除
            }

            });


            //执行删除操作
            function delAjax(id, obj) {

                $.ajax({
                    type: 'post',
                    url: '/business/deletegoods/' + id,
                    dataType: 'json',
                    success: function (data) {
                        if(data.status){
                            alert(data.info);
                            //将点击的节点删除掉
                            obj.remove();
                        }else{
                            alert(data.info);
                        }
                    },
                    error: function () {
                        alert('请求失败');

                    }

                });
            }


    })



</script>
{/block}